using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_ShopCity : Admin, IRequiresSessionState
{
	private Shop_City _mycity = null;
	protected ImageButton Button3;
	protected DropDownList DropDownList1;
	protected ObjectDataSource ObjectDataSource2;
	protected Panel Panelheand;
	protected GridView GridView1;
	protected ObjectDataSource ObjectDataSource1;
	protected Panel Pannel1;
	protected HtmlInputText TxtProvince;
	protected RequiredFieldValidator RequiredFieldValidator1;
	protected HtmlInputText TxtCity;
	protected RequiredFieldValidator RequiredFieldValidator2;
	protected CheckBox chFlag;
	protected Button Button2;
	protected Button Button1;
	protected Panel panneladd;
	protected Shop_City mycity
	{
		get
		{
			Shop_City mycity;
			if (this._mycity == null)
			{
				this._mycity = new Shop_City();
				mycity = this._mycity;
			}
			else
			{
				mycity = this._mycity;
			}
			return mycity;
		}
	}
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(25))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "City");
			base.WriteRightErrMsg();
		}
		if (!this.Page.IsPostBack)
		{
			this.Pannel1.Visible = true;
			this.panneladd.Visible = false;
		}
	}
	protected void Button2_Click(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(25))
		{
			base.WriteLog("Modify", Language.GetAdminMsg("Log/Access", "0"), "City");
			base.WriteRightErrMsg();
		}
		bool flag = false;
		if (this.chFlag.Checked)
		{
			flag = true;
		}
		if (this.mycity.AddCity(this.TxtProvince.Value.Trim(), this.TxtCity.Value.Trim(), string.Empty, string.Empty, flag))
		{
			this.WriteSuccessMsg("", Language.GetAdminMsg("Common/AddSuccess"), "Admin_ShopCity.aspx");
		}
		else
		{
			this.WriteErrMsg("", Language.GetAdminMsg("Common/EditFail"), "未知错误");
		}
	}
	protected void Button1_Click(object sender, EventArgs e)
	{
		this.Pannel1.Visible = true;
		this.panneladd.Visible = false;
		base.Response.Redirect("admin_shopcity.aspx");
	}
	protected void Button3_Click(object sender, EventArgs e)
	{
		this.Pannel1.Visible = false;
		this.panneladd.Visible = true;
		this.Panelheand.Visible = false;
	}
	protected void GridView1_DataBound(object sender, EventArgs e)
	{
		foreach (GridViewRow gridViewRow in this.GridView1.Rows)
		{
			if (gridViewRow.RowType == DataControlRowType.DataRow)
			{
				gridViewRow.Attributes.Add("onmouseover", "cc(this)");
				gridViewRow.Attributes.Add("onmouseout", "cc1(this)");
			}
			if (!base.admin.CheckAdminPower(25))
			{
				gridViewRow.Cells[3].Enabled = false;
			}
			if (!base.admin.CheckAdminPower(25))
			{
				gridViewRow.Cells[4].Enabled = false;
			}
		}
	}
}
